﻿using AutoMapper;
using BCVP.Net8.Model;
using BCVP.Net8.Model.logrecode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using static System.Runtime.InteropServices.JavaScript.JSType;

namespace BCVP.Net8.Extension.mapper
{
    /// <summary>
    /// 配置构造函数，用于创建关系映射
    /// </summary>
    public class CustomProfile : Profile
    {
        public CustomProfile()
        {
            CreateMap<Role, RoleVo>().ForMember(a => a.RoleName, o => o.MapFrom(d => d.Name));
            CreateMap<RoleVo, Role>().ForMember(a => a.Name, o => o.MapFrom(d => d.RoleName));

            // 用户
            CreateMap<SysUserInfo, UserVo>().ForMember(a => a.UserName, o => o.MapFrom(d => d.Name));
            CreateMap<UserVo, SysUserInfo>().ForMember(a => a.Name, o => o.MapFrom(d => d.UserName));

            // 日志
            CreateMap<AuditSqlLog, AuditSqlLogVo>();
            CreateMap<AuditSqlLogVo, AuditSqlLog>();
        }
    }
}
